//
//  ZCFriendTrendsViewController.m
//  百思不得姐
//
//  Created by Ning Xie on 16/8/26.
//  Copyright © 2016年 zhangchong. All rights reserved.
//

#import "ZCFriendTrendsViewController.h"
#import "ZCRecommendAttentionController.h"
#import "ZCLoginViewController.h"

@interface ZCFriendTrendsViewController ()

@property (strong, nonatomic) UIImageView *iconImage;
@property (strong, nonatomic) UILabel *introduceLabel;
@property (strong, nonatomic) UIButton *logInButton;

@end

@implementation ZCFriendTrendsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"我的关注";
    self.view.backgroundColor = ZCGlobalRBG;
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"friendsRecommentIcon" selectedImage:@"friendsRecommentIcon-click" action:@selector(leftBarButtonItemClick) target:self];
    
    [self setupUI];
}
/**
 *  表头左按钮点击事件
 */
-(void)leftBarButtonItemClick{
    
    ZCRecommendAttentionController *attentionVC = [[ZCRecommendAttentionController alloc]init];
    attentionVC.navigationItem.title = @"推荐关注";
    
    [self.navigationController pushViewController:attentionVC animated:YES];
    
}
/**
 *  页面初始化
 */
-(void)setupUI{
    
    self.iconImage = [[UIImageView alloc]init];
    _iconImage.image = [UIImage imageNamed:@"header_cry_icon"];
    
    self.introduceLabel = [[UILabel alloc]init];
    _introduceLabel.text = @"快快登录吧, 关注百思最in牛人\n好友动态让你过把瘾儿~\n欧耶~~~~!";
    _introduceLabel.textAlignment = NSTextAlignmentCenter;
    _introduceLabel.textColor = [UIColor brownColor];
    _introduceLabel.numberOfLines = 0;
    [_introduceLabel sizeToFit];
    
    self.logInButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_logInButton setBackgroundImage:[UIImage imageNamed:@"friendsTrend_login"] forState:UIControlStateNormal];
    [_logInButton setBackgroundImage:[UIImage imageNamed:@"friendsTrend_login_click"] forState:UIControlStateHighlighted];
    [_logInButton setTitle:@"立即登录注册" forState:UIControlStateNormal];
    [_logInButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [_logInButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    [_logInButton addTarget:self action:@selector(loginButtonAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    [self.view addSubview:_iconImage];
    [self.view addSubview:_introduceLabel];
    [self.view addSubview:_logInButton];
    
    [_introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.center.equalTo(self.view);
    }];
    
    [_iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.bottom.equalTo(_introduceLabel.mas_top).offset(-50);
        make.width.height.mas_equalTo(50);
    }];
    
    [_logInButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_introduceLabel.mas_bottom).offset(50);
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(35);
    }];
}

-(void)loginButtonAction{
    
    ZCLog(@"点击登录注册按钮");
    ZCLoginViewController *loginVC = [[ZCLoginViewController alloc]init];
    
    [self.navigationController presentViewController:loginVC animated:YES completion:nil];
    
}

@end
